from time import time

def bubble(name):
    st = time()
    with open(name) as f:
        a = []
        for line in f:
            a.append([int(x) for x in line.split()])


    for i in range(len(a)):
        for j in range(len(a) - i - 1):
            if a[j] > a[j + 1]:
                a[j], a[j + 1] = a[j + 1], a[j]
    print(a)
    fi = time()
    t = fi - st
    print('time', name, ':', t)

bubble('m1_sorted.txt')
bubble('m2_reverse.txt')
bubble('m3_shuffle.txt')
